﻿using FormulaOne.Api.Services.Interfaces;
using FormulaOne.Entities.Contracts;
using MassTransit;

namespace FormulaOne.Api.Services
{
    public class DriverNotificationPublishService : IDriverNotificationPublishService
    {
        private readonly ILogger<DriverNotificationPublishService> _logger;
        //private readonly IBus _bus;
        private readonly IPublishEndpoint _publishEndpoint;

        public DriverNotificationPublishService(ILogger<DriverNotificationPublishService> logger, IPublishEndpoint publishEndpoint)
        {
            _logger = logger;
            _publishEndpoint = publishEndpoint;
        }

        public async Task SendNotification(Guid driverId, string teamName)
        {
            _logger.LogInformation($"Driver Notification {driverId} {teamName}");
            await _publishEndpoint.Publish(new DrvierNotificationRecord(driverId, teamName));
        }
    }
}
